/***************************************************************
*  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
*  All rights reserved.
*
*  This file is part of the GroupMe! Project. Source code of 
*  this project is closed and redistribution of this code is
*  prohibited. 
*  
*  Contact: http://www.groupme.net
*
*  This copyright notice MUST APPEAR in all copies of the file!
***************************************************************/
package net.groupme.model.dao.mem;

import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.util.Collection;

import net.groupme.exceptions.DeleteFailedException;
import net.groupme.exceptions.InsertFailedException;
import net.groupme.exceptions.UpdateFailedException;
import net.groupme.gui.constants.VIEW_VOCABULARY;
import net.groupme.model.Group;
import net.groupme.model.GroupVisualization;
import net.groupme.model.Resource;
import net.groupme.model.Tag;
import net.groupme.model.User;
import net.groupme.model.dao.UserDAO;

/**
 * created on Jan 20, 2009
 * 
 * In-Memory implementation of a user.
 * 
 * @author Fabian Abel, <a href="mailto:abel@l3s.de">abel@l3s.de</a>
 * @author last edited by: $Author: fabian $
 * 
 * @version $Revision: 1.1 $ $Date: 2009-03-11 23:13:35 $
 */
public class UserDAOMemImpl implements UserDAO {

	private String id = null;
	private String username = null;
	private String firstname = null;
	private String lastname = null;
	private String email = null;
	
	/**
	 * Creates a new UserDAOMemImpl instance.
	 * @param id
	 * @param username
	 * @param firstname
	 * @param lastname
	 * @param email 
	 */
	public UserDAOMemImpl(String id, String username, String firstname,
			String lastname, String email) {
		super();
		this.id = id;
		this.username = username;
		this.firstname = firstname;
		this.lastname = lastname;
		this.email = email;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#addGroup(net.groupme.model.Group, java.lang.String)
	 */
	public void addGroup(Group group, String role) throws InsertFailedException {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#addTag(net.groupme.model.Tag)
	 */
	public void addTag(Tag tag) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#addVisualization(net.groupme.model.GroupVisualization)
	 */
	public void addVisualization(GroupVisualization groupVisualization) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#checkPassword(java.lang.String)
	 */
	public boolean checkPassword(String password) {
		// TODO Auto-generated method stub
		return false;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getActualVisualization(net.groupme.model.Group)
	 */
	public GroupVisualization getActualVisualization(Group group) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getEmail()
	 */
	public String getEmail() {
		return email;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getFirstName()
	 */
	public String getFirstName() {
		return firstname;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getFoaf()
	 */
	public String getFoaf() {
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getGroups()
	 */
	public Collection<Group> getGroups() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getGroups(java.lang.String)
	 */
	public Collection<Group> getGroups(String role) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getLastName()
	 */
	public String getLastName() {
		return lastname;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getPhoto()
	 */
	public String getPhoto() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getTags()
	 */
	public Collection<Tag> getTags() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getTags(net.groupme.model.Resource)
	 */
	public Collection<Tag> getTags(Resource taggedResource) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getURI()
	 */
	public URI getURI() {
		try {
			return new URI(VIEW_VOCABULARY.RESTful_USER_URI_PATTERN + username);//$NON-NLS-1$
		} catch (URISyntaxException e) {
			e.printStackTrace();
			return null;
		}
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getUserName()
	 */
	public String getUserName() {
		return username;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getVisualizations()
	 */
	public Collection<GroupVisualization> getVisualizations() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#getVisualizations(net.groupme.model.Group)
	 */
	public Collection<GroupVisualization> getVisualizations(Group group) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#removeGroup(net.groupme.model.Group)
	 */
	public void removeGroup(Group group) throws DeleteFailedException {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#removeTag(net.groupme.model.Tag)
	 */
	public void removeTag(Tag tag) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#removeVisualization(net.groupme.model.GroupVisualization)
	 */
	public void removeVisualization(GroupVisualization groupVisualization) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#setActualVisualization(net.groupme.model.Group, net.groupme.model.GroupVisualization)
	 */
	public void setActualVisualization(Group group,
			GroupVisualization groupVisualization) throws UpdateFailedException {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#setEmail(java.lang.String)
	 */
	public void setEmail(String email) throws UpdateFailedException {
		this.email = email;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#setFirstName(java.lang.String)
	 */
	public void setFirstName(String firstname) throws UpdateFailedException {
		this.firstname = firstname;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#setFoaf(java.lang.String)
	 */
	public void setFoaf(String foaf) throws UpdateFailedException {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#setLastName(java.lang.String)
	 */
	public void setLastName(String lastname) throws UpdateFailedException {
		this.lastname = lastname;

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#setPassword(java.lang.String)
	 */
	public void setPassword(String password) throws UpdateFailedException {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.User#setPhoto(java.lang.String)
	 */
	public void setPhoto(String photo) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.Identifiable#getDescription()
	 */
	public String getDescription() {
		return "";
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.Identifiable#getId()
	 */
	public String getId() {
		return this.id;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.Identifiable#getLabel()
	 */
	public String getLabel() {
		return this.username;
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.Identifiable#setDescription(java.lang.String)
	 */
	public void setDescription(String description) throws UpdateFailedException {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see net.groupme.model.Identifiable#setLabel(java.lang.String)
	 */
	public void setLabel(String label) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object otherUser) {
		if(otherUser instanceof User){
			return this.id.equals(((User)otherUser).getId());
		}
		return false;
	}
}
